<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/14
 * Time: 0:39
 */

namespace app\api\controller;
use app\common\controller\BaseApi;
use app\common\model\OpenServiceManage;

class Openservice extends BaseApi
{
    //获取所有开服信息
    public function getRows(){
        return $this->commonData(1,OpenServiceManage::instance()->doPage()->alias('os')->order("service_start_time desc")
            ->join('enterprise e','e.id=os.enterprise_id')->join('game_info g','g.id = os.game_id')->field('os.*,e.enterprise_name,g.game_name')->select());
    }

    //获取单个游戏的开服时间信息
    public  function  getByGame()
    {
        return $this->commonData(1,OpenServiceManage::instance()->where(['os.game_id'=>I('id',1,'intval')])->alias('os')
            ->join('game_info g','g.id=os.game_id')
            ->field('os.*,g.id,g.game_name')->select());
    }
}